<?php 
	include ("../../config/koneksi.php");
	$id = $_GET['id'];
	$q = "select * from tarif_obat t inner join master_obat m on m.kode_obat = t.id_obat inner join satuan s on m.id_satuan = s.id_satuan where id_ppk = $id";
	$r = mysql_query($q);
	
	$nama = mysql_fetch_array(mysql_query("select nama from ppk where id_ppk = $id"));
	
	$content = "DAFTAR TARIF OBAT\nPPK : $nama[nama]\n\nNO;KODE;NAMA OBAT;SATUAN;TARIF\n";
	while ($data = mysql_fetch_array($r)) {
		$no++;
		$content .= "$no;$data[id_obat];$data[nama_obat];$data[satuan];$data[tarif]\n";
	};

	header("Content-type: text/csv");
	header("Content-Disposition: attachment; filename=tarif_obat.csv");
	header("Pragma: no-cache");
	header("Expires: 0");
	echo $content;
?>